namespace ext.util
{
	using System;
	using System.Runtime.CompilerServices;
	using System.Html;
	using System.Collections;
	
	
	/// <summary>
	/// Provides the ability to execute one or more arbitrary tasks in a multithreaded
	/// manner. Generally, you can use the singleton {@link Ext.TaskMgr} instead, but
	/// if needed, you can create separate instances of TaskRunner. Any number of
	/// separate tasks can be started at any time and will run independently of each
	/// other. Example usage:
	/// 
	/// // Start a simple clock task that updates a div once per second
	/// var updateClock = function(){
	/// Ext.fly(&apos;clock&apos;).update(new Date().format(&apos;g:i:s A&apos;));
	/// }
	/// var task = {
	/// run: updateClock,
	/// interval: 1000 //1 second
	/// }
	/// var runner = new Ext.util.TaskRunner();
	/// runner.start(task);
	///
	/// // equivalent using TaskMgr
	/// Ext.TaskMgr.start({
	/// run: updateClock,
	/// interval: 1000
	/// });
	///
	///  See the {@link #start} method for details about how to configure a task object. 
	/// Also see {@link Ext.util.DelayedTask}.
	/// </summary>
	/// <htmlSummary>
	/// Provides the ability to execute one or more arbitrary tasks in a multithreaded
	/// manner. Generally, you can use the singleton {@link Ext.TaskMgr} instead, but
	/// if needed, you can create separate instances of TaskRunner. Any number of
	/// separate tasks can be started at any time and will run independently of each
	/// other. Example usage:
	/// &lt;pre&gt;&lt;code&gt;
	/// // Start a simple clock task that updates a div once per second
	/// var updateClock = function(){
	/// Ext.fly(&apos;clock&apos;).update(new Date().format(&apos;g:i:s A&apos;));
	/// }
	/// var task = {
	/// run: updateClock,
	/// interval: 1000 //1 second
	/// }
	/// var runner = new Ext.util.TaskRunner();
	/// runner.start(task);
	///
	/// // equivalent using TaskMgr
	/// Ext.TaskMgr.start({
	/// run: updateClock,
	/// interval: 1000
	/// });
	///
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;See the {@link #start} method for details about how to configure a task object.&lt;/p&gt;
	/// Also see {@link Ext.util.DelayedTask}.
	/// </htmlSummary>
	/// <definedin>src\ext-core\src\util\TaskMgr.js</definedin>
	[ScriptName("TaskRunner")]
	[ScriptNamespace("Ext.util")]
	[Imported()]
	public partial class TaskRunner
	{
		
		#region Constructors
		/// <summary>Constructor</summary>
		/// <param name="interval">
		/// The minimum precision in milliseconds supported by this TaskRunner instance
		/// (defaults to 10)
		/// </param>
		public TaskRunner(System.Number interval)
		{
		}
		
		/// <summary>Constructor</summary>
		public TaskRunner()
		{
		}
		#endregion
		
		#region Methods
		/// <summary>Starts a new task.</summary>
		/// <definedin>src\ext-core\src\util\TaskMgr.js</definedin>
		/// <param name="task">
		/// &lt;p&gt;A config object that supports the following properties:&lt;ul&gt;
		/// &lt;li&gt;<c>run</c> : Function&lt;div class=&quot;sub-desc&quot;&gt;&lt;p&gt;The function to execute each time the task is invoked. The
		/// function will be called at each interval and passed the <c>args</c> argument if specified, and the
		/// current invocation count if not.&lt;/p&gt;
		/// &lt;p&gt;If a particular scope (<c>this</c> reference) is required, be sure to specify it using the <c>scope</c> argument.&lt;/p&gt;
		/// &lt;p&gt;Return <c>false</c> from this function to terminate the task.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;
		/// &lt;li&gt;<c>interval</c> : Number&lt;div class=&quot;sub-desc&quot;&gt;The frequency in milliseconds with which the task
		/// should be invoked.&lt;/div&gt;&lt;/li&gt;
		/// &lt;li&gt;<c>args</c> : Array&lt;div class=&quot;sub-desc&quot;&gt;(optional) An array of arguments to be passed to the function
		/// specified by <c>run</c>. If not specified, the current invocation count is passed.&lt;/div&gt;&lt;/li&gt;
		/// &lt;li&gt;<c>scope</c> : Object&lt;div class=&quot;sub-desc&quot;&gt;(optional) The scope (&lt;tt&gt;this&lt;/tt&gt; reference) in which to execute the
		/// <c>run</c> function. Defaults to the task config object.&lt;/div&gt;&lt;/li&gt;
		/// &lt;li&gt;<c>duration</c> : Number&lt;div class=&quot;sub-desc&quot;&gt;(optional) The length of time in milliseconds to invoke
		/// the task before stopping automatically (defaults to indefinite).&lt;/div&gt;&lt;/li&gt;
		/// &lt;li&gt;<c>repeat</c> : Number&lt;div class=&quot;sub-desc&quot;&gt;(optional) The number of times to invoke the task before
		/// stopping automatically (defaults to indefinite).&lt;/div&gt;&lt;/li&gt;
		/// &lt;/ul&gt;&lt;/p&gt;
		/// &lt;p&gt;Before each invocation, Ext injects the property <c>taskRunCount</c> into the task object so
		/// that calculations based on the repeat count can be performed.&lt;/p&gt;
		/// </param>
		/// <returns>The task</returns>
		[ScriptName("start")]
		public object Start(object task)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Stops an existing running task.</summary>
		/// <definedin>src\ext-core\src\util\TaskMgr.js</definedin>
		/// <param name="task">The task to stop</param>
		/// <returns>The task</returns>
		[ScriptName("stop")]
		public object Stop(object task)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Stops all tasks that are currently running.</summary>
		/// <definedin>src\ext-core\src\util\TaskMgr.js</definedin>
		[ScriptName("stopAll")]
		public void StopAll()
		{
			throw new System.Exception("Imported - not implemented");
		}
		#endregion
	}
}
